package com.speciality.demo.demos.config;

import org.apache.spark.sql.SparkSession;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SparkConfig {
    @Bean
    public SparkSession sparkSession() {
        return SparkSession.builder()
                .master("local[*]") // 本地开发（生产改集群地址，如 spark://host:7077）
                .appName("WeatherAnomalyPrediction")
                .config("spark.sql.warehouse.dir", "file:///tmp/spark-warehouse")
                .config("spark.driver.memory", "2g") // 按需调整内存
                .getOrCreate();
    }
}
